/* Copyright (c) 2010 OFXKit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <Foundation/Foundation.h>

#import "OFXObject.h"
#import "OFXAccount.h"
#import "OFXPayee.h"
#import "OFXImage.h"
#import "OFXFinancialInstitution.h"

@interface OFXTransaction : OFXObject {
  NSNumber* amount;
  NSString* correctingAction;
  NSString* correctingUniqueId;
  NSString* checkNumber;
  OFXCurrency* currency;
  NSDate* dateAvailable;
  NSDate* dateInitiated;
  NSDate* datePosted;
  OFXFinancialInstitution* financialInstitution;
  OFXImage* image;
  NSString* memo;
  OFXPayee* payee;
  NSString* referenceNumber;
  NSString* serverTransactionId;
  NSString* standardIndustrialCode;
  NSString* transactionDescription;
  NSString* transactionType;
  OFXAccount* transferToAccount;
  NSString* uniqueId;
  NSString* uniqueIdType;
}

/**
 * @property amount
 * @brief Amount of transaction
 */
@property(retain) NSNumber* amount;

/**
 * @property checkNumber
 * @brief Check (or other reference) number, A-12
 */
@property(retain) NSString* checkNumber;

/**
 * @property correctingAction
 * @brief Actions can be REPLACE or DELETE. REPLACE replaces the transaction 
 * referenced by correctingUniqueId; DELETE deletes it.
 */
@property(retain) NSString* correctingAction;

/**
 * @property correctingUniqueId
 * @brief If present, the uniqueId of a previously sent transaction that is 
 * corrected by this record. 
 *
 * This transaction replaces or deletes the transaction that it corrects, based
 * on the value of correctingAction.
 */
@property(retain) NSString* correctingUniqueId;

/**
 * @property currency
 * @brief Currency of transaction (if different from statement currency)
 */
@property(retain) OFXCurrency* currency;

/**
 * @property dateAvailable
 * @brief Date funds are available (value date)
 */
@property(retain) NSDate* dateAvailable;

/**
 * @property dateInitiated
 * @brief Date transaction initiated.
 */
@property(retain) NSDate* dateInitiated;

/**
 * @property datePosted
 * @brief Date transaction posted to account.
 */
@property(retain) NSDate* datePosted;

/**
 * @property financialInstitution
 * @brief Financial institution transaction occurred at.
 */
@property(retain) OFXFinancialInstitution* financialInstitution;

/**
 * @property image
 * @brief Image of the transaction.
 */
@property(retain) OFXImage* image;

/**
 * @property memo
 * @brief Extra information (not in <NAME>)
 */
@property(retain) NSString* memo;

/**
 * @property payee
 * @brief Payee information
 */
@property(retain) OFXPayee* payee;

/**
 * @property referenceNumber
 * @brief Reference number that uniquely identifies the transaction. 
 *
 * Can be used in addition to or instead of a checkNumber, A-32
 */
@property(retain) NSString* referenceNumber;

/**
 * @property serverTransactionId
 * @brief Server assigned transaction ID.
 *
 * used for transactions initiated by client, such as payment or funds 
 * transfer. If a transaction associated with a transfer contains a SRVRTID, 
 * the associated account is either the transfer's "to" or "from" account. 
 * Transactions for both accounts in a transfer would contain the same SRVRTID.
 */
@property(retain) NSString* serverTransactionId;

/**
 * @property standardIndustrialCode
 * @brief Standard Industrial Code, N-6
 */
@property(retain) NSString* standardIndustrialCode;

/**
 * @property transactionDescription
 * @brief Description of transaction
 */
@property(retain) NSString* transactionDescription;

/**
 * @property transactionType
 * @brief Transaction type
 *
 * Valid values:
 * - CREDIT: Generic credit
 * - DEBIT: Generic debt
 * - INT: Interest earned or paid, note: depends on signage of amount
 * - DIV: Dividend 
 * - FEE: Financial Insitution fee
 * - SRVCHG: Service charge 
 * - DEP: Deposit
 * - ATM: ATM debit or credit, note: Depends on signage of amount
 * - POS: Point of sale debit or credit, note: Depends on signage of amount
 * - XFER: Transfer
 * - CHECK: Check
 * - PAYMENT: Electronic payment
 * - CASH: Cash withdrawal
 * - DIRECTDEP: Direct deposit
 * - DIRECTDEBIT: Merchant initiated debit
 * - REPEATPMT: Repeating payment/standing order
 * - OTHER
 * 
 * This element does not change the effect of the transaction upon the balance 
 * (increases and decreases are indicated by the sign of the amount
 */
@property(retain) NSString* transactionType;

/**
 * @property transferToAccount
 * @brief Account to transfer to.
 */
@property(retain) OFXAccount* transferToAccount;

/**
 * @property uniqueId
 * @brief Financial institution unique id assigned to transaction.
 */
@property(retain) NSString* uniqueId;

@end
